<?php 

use_stylesheet('list.css');
use_helper('toolsbar');
slot('Toolsbar');
   echo setToolbar('index','supplier');
end_slot();
slot('PageTitle',"Supplier");
slot('Title',"Supplier Overview"); 

?>

<table id="lista">
  <thead>
    <tr>
      <th <?php if ($sf_user->getOrderField()=='name') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=name"?>">Name</a></th>
      <th <?php if ($sf_user->getOrderField()=='type') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=type"?>">Type</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref1') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=ref1"?>">Ref1</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref2') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=ref2"?>">Ref2</a></th>
      <th <?php if ($sf_user->getOrderField()=='ref3') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=ref3"?>">Ref3</a></th>
      <th <?php if ($sf_user->getOrderField()=='path') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=path"?>">Path</a></th>
      <th <?php if ($sf_user->getOrderField()=='note') echo 'class=order'?>><a href="<?php echo url_for('supplier')."?orderBy=note"?>">Note</a></th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($suppliers as $key=>$supplier): $odd = fmod($key, 2) ? 'odd' : 'even'?>
    <tr class="<?php echo $odd ?>">
      <td><a href='<?php echo url_for('supplier_show',$supplier)?>'> <?php echo $supplier->getName() ?> </a></td>
      <td><?php echo $supplier->getType() ?></td>
      <td><a href='<?php echo url_for('contact_show',$supplier->getContact())?>'><?php echo $supplier->getContact()?></a></td>
      <td><a href='<?php echo url_for('contact_show',$supplier->getContact_2())?>'><?php echo $supplier->getContact_2()?></a></td>
      <td><a href='<?php echo url_for('contact_show',$supplier->getContact_3())?>'><?php echo $supplier->getContact_3()?></a></td>
      <td><?php echo $supplier->getPath() ?></td>
      <td><?php echo $supplier->getNote() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
